package org.kernely.stream.userpage;


import org.kernely.ui.mvp.IKernelyView;

import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Tree;
import com.vaadin.ui.VerticalLayout;

public class StreamSettingsWindowView extends VerticalLayout implements IKernelyView {

	private Button saveButton;
	private Tree subscriptionsTree;
	private Panel treePanel;
	private Label title;
	

	public StreamSettingsWindowView(){
		HorizontalLayout buttonsLayout = new HorizontalLayout();

		this.addComponent(buttonsLayout);
		buttonsLayout.setMargin(true, true, true, true);
		HorizontalLayout titleLayout = new HorizontalLayout();
		titleLayout.setMargin(true,true,false,true);
		
		treePanel = new Panel();
		treePanel.setScrollable(true);
		treePanel.setStyleName(Panel.STYLE_LIGHT);
		this.saveButton = new Button("Save");
		this.subscriptionsTree = new Tree();
		this.subscriptionsTree.setImmediate(true);
		this.title = new Label("Please select the streams you want to subscribe.");
		this.title.setWidth(220,UNITS_PIXELS);
		titleLayout.addComponent(title);
		treePanel.addComponent(subscriptionsTree);
		treePanel.setSizeFull();
		treePanel.setHeight(300,UNITS_PIXELS);
		treePanel.setScrollable(true);
		buttonsLayout.addComponent(saveButton);
		buttonsLayout.setComponentAlignment(saveButton, Alignment.BOTTOM_CENTER);
		this.addComponent(titleLayout);
		this.addComponent(treePanel);
		this.addComponent(buttonsLayout);
		this.setComponentAlignment(titleLayout, Alignment.TOP_CENTER);
		this.setComponentAlignment(treePanel, Alignment.MIDDLE_CENTER);
		this.setComponentAlignment(buttonsLayout, Alignment.BOTTOM_CENTER);
		this.setWidth(250, UNITS_PIXELS);
		this.setHeight(450, UNITS_PIXELS);
		this.setSpacing(true);
	}
	
	/**
	 * Useless method.
	 */
	@Override
	public final Component getComponent() {
		return this;
	}

	/**
	 * Gets the saveButton
	 * @return the saveButton
	 */
	public final Button getSaveButton() {
		return saveButton;
	}
	
	
	
	/**
	 * Gets the subscriptionsTree
	 * @return the subscriptionsTree
	 */
	public final Tree getSubscriptionsTree() {
		return subscriptionsTree;
	}

}
